package day03;

import com.sun.corba.se.spi.ior.IdentifiableFactory;
import org.jcp.xml.dsig.internal.dom.DOMTransform;

import javax.xml.transform.Source;
import java.net.SocketTimeoutException;
import java.util.Scanner;

public class IfElseIfDemo {
    public static void main(String[] args) {
        /*
        System.out.println(5%2);//1
        System.out.println(8%2);//0
        System.out.println(2%8);//2

        int a=5,b=5;
        a++;
        ++b;
        System.out.println(a);//6
        System.out.println(b);//6

        int a1=5,b1=5;
        a1--;
        --b1;
        System.out.println(a1);//4
        System.out.println(b1);//4

        int a2=5,b2=5;
        int c=a2++;
        int d=++b2;
        System.out.println(a2);//6
        System.out.println(b2);//6
        System.out.println(c);//5
        System.out.println(d);//6

        int e=5,f=5;
        int c1=e--;
        int d1=--f;
        System.out.println(e);//4
        System.out.println(f);//4
        System.out.println(c1);//5
        System.out.println(d1);//4

        int c2=5,d2=10,e1=5;
        boolean f1=d2>e1;
        System.out.println(f1);//true
        System.out.println(e1>d2);//true
        System.out.println(c2>=e1);//true
        System.out.println(d2<=c2);//false
        System.out.println(d2==e1);//false
        System.out.println(c2!=e1);//false

        System.out.println(c2+e1>10);//false
        System.out.println(d2%2==0);//true
        System.out.println(e1++>5);//false
        System.out.println(e1++>5);//true

        int g=5,h=10,j=5;
        boolean k=h>=g&&h<j;
        System.out.println(k);//true&&false=false
        System.out.println(h<=g&&h>g);//false&&true=false
        System.out.println(g==h&&j>h);//false&&false=false
        System.out.println(h!=j&&g<h);//true&&true=true

        System.out.println(h>=g||h<j);//true&&false=true
        System.out.println(h<=j||h>g);//false&&true=true
        System.out.println(h!=j&&g<h);//true&&true=true
        System.out.println(g==h&&j>h);//false&&false=false

        boolean z=!(g>h);
        System.out.println(z);//!true=false
        System.out.println(!(g>h));//!false=true

        int x=5,v=10,n=5;
        boolean b3=x>v&&n++>2;
        System.out.println(b3);//false
        System.out.println(n);//5,发生短路

        int p=5;
        p+=10;
        System.out.println(p);//15
        p*=2;
        System.out.println(p);//30
        p/=6;
        System.out.println(p);//5

        short s=5;
        //s=s+10;//编译错误，改为：s=(short)(s+10);
        s+=10;

        int age=38;
        System.out.println("age=");//age=
        System.out.println(age);//38
        System.out.println("age"+age);//age=38
        System.out.println("我的年龄是"+age);//我的年龄是38
        System.out.println("我今年"+age+"岁了");//我今年38岁了

        String name="wkj";
        System.out.println("name="+name);//name=wkj
        System.out.println("大家好，我叫"+name);
        System.out.println("大家好，我叫"+name+",今年"+age+"岁了");

        System.out.println(10+20+""+30);//3030
        System.out.println(""+10+20+30);//102030
        System.out.println(10+20+30+"");//60

        int num=5;
        int flag=num>0?1:-1;
        System.out.println(flag);//1

        int r=8,t=5;
        int max=r>t?r:t;
        System.out.println("max"+max);

        //满500打8折
        double pr=300.0;
        if (pr>=500){
            pr*=0.8;
        }
        System.out.println("最终消费金额为"+pr);

        int sc=555;
        if (sc>=0&&sc<=100){
            System.out.println("成绩合法");
        }
        System.out.println("继续执行...");

        //满500打8折，不满500打9折
        double pe=300.0;
        if (pe>=500){
            pe*=0.8;
        }else {
            pe*=0.9;
        }
        System.out.println("最终消费金额为："+pe);

        int sco=95;
        if (sco>=0&&sco<=100){
            System.out.println(sco+"是合法成绩");
        }else {
            System.out.println(sco+"是不合法成绩");
        }

        //满2000打5折，满1000不满2000打7折，满500不满1000打8折，不满500打9折
        double pri=6000.0;
        if (pri>=2000){
            pri*=0.5;
        }else if (pri>=1000){
            pri*=0.7;
        }else if (pri>=500){
            pri*=0.8;
        }else if (pri<500){
            pri*=0.9;
        }
        System.out.println("最终消费金额为："+pri);
        */
        /*
        System.out.println(5%2);
        System.out.println(8%2);
        System.out.println(2%8);

        int a=5,b=5;
        a++;
        ++b;
        System.out.println(a);
        System.out.println(b);
        int a1=5,b1=5;
        a1--;
        --b1;
        System.out.println(a1);
        System.out.println(b1);
        int a2=5,b2=5;
        int c=a2++;
        int d=++b2;
        System.out.println(a2);
        System.out.println(b2);
        System.out.println(c);
        System.out.println(d);
        */
        /*
        int a=5,b=5;
        int c=a--;
        int d=--b;
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
        System.out.println(d);
        *//*
        int a=5,b=10,c=5;
        boolean b1=b>a;
        System.out.println(b1);
        System.out.println(c>b);
        System.out.println(a>=c);
        System.out.println(b<=a);
        System.out.println(b==c);
        System.out.println(a!=c);
        System.out.println(a+c>10);
        System.out.println(b%2==0);
        System.out.println(c++>5);
        System.out.println(c++>5);
        *//*
        int a=5,b=10,c=5;
        boolean b1=b>=a&&b<c;
        System.out.println(b1);
        System.out.println(b<=c&&b>a);
        System.out.println(a==b&&c>b);
        System.out.println(b!=c&&a<b);
        System.out.println(b>=a||b<c);
        System.out.println(b<=c||b>a);
        System.out.println(b!=c||a<b);
        System.out.println(a==b||c>b);
        boolean b2=!(a<b);
        System.out.println(b2);
        System.out.println(!(a>b));
        *//*
         int a=5,b=10,c=5;
         boolean b3=a>b&&c++>2;
        System.out.println(b3);
        System.out.println(c);
        boolean b4=a<b||c++>2;
        System.out.println(b4);
        System.out.println(c);
        *//*
        int a=5;
        a+=10;
        System.out.println(a);
        a*=2;
        System.out.println(a);
        a/=6;
        System.out.println(a);
        short s=5;
        s+=10;
        int age=38;
        System.out.println("age=");
        System.out.println(age);
        System.out.println("age"+age);
        System.out.println("我的年龄是"+age);
        System.out.println("我今年"+age+"岁了");
        String name="wkj";
        System.out.println("name"+name);
        System.out.println("大家好，我叫"+name);
        System.out.println(10+20+""+30);
        System.out.println(""+10+20+30);
        System.out.println(10+20+30+"");
        int num=5;
        int flag=num>0?1:-1;
        System.out.println(flag);
        *//*
        int a=8,b=5;
        int max=a>b?a:b;
        System.out.println("max="+max);
        double pr=300.0;
        if (pr>=500){
            pr*=0.8;
        }
        System.out.println("最终消费金额为："+pr);
        int sc=555;
        if (sc>=0&&sc<=100){
            System.out.println("合法成绩");
        }
        System.out.println("继续执行。。。。");
        double pri=300.0;
        if (pri>=500){
            pri*=0.8;
        }else{
            pri*=0.9;
        }
        System.out.println("最终消费金额为："+pri);
        int scr=95;
        if (scr>=0&&scr<=100){
            System.out.println(scr+"是合法成绩");
        }else{
            System.out.println(scr+"是不合法成绩");
        }
        double pe=6000.0;
        if (pe>=2000){
            pe*=0.5;
        }else if(pe>=1000){
            pe*=0.7;
        }else if (pe>=500){
            pe*=0.8;
        }else if (pe<500){
            pe*=0.9;
        }
        *//*
        int n=2000;
        if (n%4==0&&n%100!=0||n%400==0){
            System.out.println("闰年");
        }else {
            System.out.println("平年");
        }
        int cj=78;
        if (cj>=90){
            System.out.println("成绩合法");
        }else if (cj>=80&&cj<90){
            System.out.println("良好");
        }else if(cj>=60&&cj<80){
            System.out.println("及格");
        }else if (cj<60){
            System.out.println("不及格");
        }else if (cj<=0||cj>=100){
            System.out.println("成绩错误");
        }
        int a =8,b=5;
        int max=a>b?a:b;
        System.out.println("max="+max);
        if (a>b){
            max=a;
        }else{
            max=b;
        }
        System.out.println("max"+max);
*//*
        int a=10,b=3;
        int c=a>b?a:b;
        System.out.println("c="+c);
        if (a>b){
            c=a;
        }else {
            c=b;
        }
        int n=2008;
        if (n%4==0&&n%100!=0||n%400==0){
            System.out.println("闰年");
        }else{
            System.out.println("平年");
        }
        int cj=75;
        if (cj>=90&&cj<=100){
            System.out.println("优秀");
        }else if (cj>=80&&cj<90){
            System.out.println("良好");
        }else if (cj>=70&&cj<80){
            System.out.println("一般");
        }else if (cj>=60&&cj<70){
            System.out.println("及格");
        }else if(cj<60&&cj>=0){
            System.out.println("不及格");
        }else if (cj<100||cj<0){
            System.out.println("成绩错误");
        }
        */













    }
}
